﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:models="clr-namespace:ZFCNew.ViewModels"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:ZFCNew_Controls="clr-namespace:ZFCNew.Controls" xmlns:ZFCNew_Vectors="clr-namespace:ZFCNew.Vectors" mc:Ignorable="d"
	x:Class="ZFCNew.Views.FacebookSearch"
	UseLayoutRounding="True"
	Width="Auto" Height="Auto">
    <UserControl.Resources>
        <models:FacebookSearchModel x:Key="FacebookSearchModelDataSource" />

        <DataTemplate x:Key="FriendsUpateDataTemplate">
            <Grid x:Name="grid" d:DesignWidth="538" Width="700" Margin="0,5,0,0" RenderTransformOrigin="0.914,0.5">
                <Grid.RenderTransform>
                    <CompositeTransform/>
                </Grid.RenderTransform>
                <VisualStateManager.CustomVisualStateManager>
                    <ei:ExtendedVisualStateManager/>
                </VisualStateManager.CustomVisualStateManager>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="MouseHover">
                        <VisualStateGroup.Transitions>
                            <VisualTransition GeneratedDuration="0" To="MouseHoverState"/>
                        </VisualStateGroup.Transitions>
                        <VisualState x:Name="MouseHoverState">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="grid">
                                    <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                    <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="3"/>
                                    <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="normal"/>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="MouseEnter">
                        <ei:GoToStateAction StateName="MouseHoverState"/>
                    </i:EventTrigger>
                    <i:EventTrigger EventName="MouseLeave">
                        <ei:GoToStateAction StateName="normal"/>
                    </i:EventTrigger>

                </i:Interaction.Triggers>
                <Grid>

                    <Rectangle Margin="0,0,48,0" Stroke="#FFFFC700" VerticalAlignment="Center" Height="100" RadiusX="15" RadiusY="15" StrokeThickness="2" Fill="Black"/>
                    <TextBlock x:Name="textBlock" TextWrapping="Wrap" Text="{Binding message, FallbackValue=Loading ...}" Margin="12,15,116,15" Foreground="White" FontSize="16" FontFamily="Lucida Sans Unicode" TextTrimming="WordEllipsis" MaxHeight="86"/>
                    <Ellipse Width="120" x:Name="MainEllipse" Height="120" HorizontalAlignment="Right" Stroke="#FFFFC700" StrokeThickness="5" Fill="#FF111111" Cursor="Hand"  />
                    <Viewbox HorizontalAlignment="Right" Margin="0" Width="120" Height="120" IsHitTestVisible="False">
                        <ZFCNew_Vectors:Zakumi Width="100" Height="100" RenderTransformOrigin="0.5,0.5" Margin="0,0,75,91">
                            <ZFCNew_Vectors:Zakumi.RenderTransform>
                                <CompositeTransform ScaleX="0.25" ScaleY="0.25"/>
                            </ZFCNew_Vectors:Zakumi.RenderTransform>
                        </ZFCNew_Vectors:Zakumi>
                    </Viewbox>
                    <Ellipse Width="120" Height="120" HorizontalAlignment="Right" Stroke="#FFFFC700" StrokeThickness="5" IsHitTestVisible="False">
                        <Ellipse.Fill>
                            <ImageBrush ImageSource="{Binding ProfileImageUrl}" />
                        </Ellipse.Fill>
                    </Ellipse>

                </Grid>
            </Grid>
        </DataTemplate>

    </UserControl.Resources>

    <Border Width="750" Height="595" BorderThickness="4">

        <Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource FacebookSearchModelDataSource}}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click" SourceObject="{Binding ElementName=NextBtn}">
                    <i:InvokeCommandAction Command="{Binding GetNextResultSetCommand}"/>
                </i:EventTrigger>
                <i:EventTrigger EventName="Click" SourceObject="{Binding ElementName=PrevBtn}">
                    <i:InvokeCommandAction Command="{Binding GetPreviousResultSetCommand}"/>
                </i:EventTrigger>
                <i:EventTrigger EventName="Click" SourceObject="{Binding ElementName=SearchBtn}">
                    <i:InvokeCommandAction Command="{Binding GeneralSearchCommand}" CommandParameter="{Binding Text, ElementName=SearchTB}"/>
                </i:EventTrigger>
                <i:EventTrigger EventName="Checked" SourceObject="{Binding ElementName=radioButton1}">
                    <i:InvokeCommandAction Command="{Binding GetFriendsUpateCommand}" CommandParameter="{Binding Text, ElementName=SearchTB}"/>
                </i:EventTrigger>


                <i:EventTrigger EventName="Click" SourceObject="{Binding ElementName=NextBtn_Copy}">
                    <i:InvokeCommandAction Command="{Binding GetNextFriendsUpateCommand}"/>
                </i:EventTrigger>
                <i:EventTrigger EventName="Click" SourceObject="{Binding ElementName=PrevBtn_Copy}">
                    <i:InvokeCommandAction Command="{Binding GetPreviousFriendsUpateCommand}"/>
                </i:EventTrigger>
                
                
            </i:Interaction.Triggers>

            <Grid Margin="26,22,0,0"  RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top" HorizontalAlignment="Left">
                <Grid.RenderTransform>
                    <CompositeTransform ScaleX="0.6" ScaleY="0.6"/>
                </Grid.RenderTransform>
                <RadioButton  x:Name="radioButton" Content="Search facebook" Style="{StaticResource ZFCNavStyle}" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="144,-31,0,0" IsChecked="True" RenderTransformOrigin="0.5,0.5" d:LayoutOverrides="VerticalAlignment">
                    <RadioButton.RenderTransform>
                        <CompositeTransform ScaleX="0.7" ScaleY="0.7"/>
                    </RadioButton.RenderTransform>
                </RadioButton>
                <RadioButton x:Name="radioButton1" Content="What your friends saying" Style="{StaticResource ZFCNavStyle}" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" Margin="-6,6,0,-6" IsEnabled="{Binding IsLoggedIn, Mode=OneWay}" Width="566" d:LayoutOverrides="Height">
                    <RadioButton.RenderTransform>
                        <CompositeTransform ScaleX="0.7" ScaleY="0.7"/>
                    </RadioButton.RenderTransform>
                </RadioButton>
            </Grid>
            <Grid Visibility="{Binding IsChecked, Converter={StaticResource VisibilityConverter}, ElementName=radioButton}">
            <ItemsControl
        ItemTemplate="{StaticResource ZakumiListBoxItemDataTemplate}" ItemsSource="{Binding CurrentResult}" Background="{x:Null}" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Margin="30,63,0,20" />
            <Button x:Name="NextBtn" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="61" Margin="0,0,185,-6" Style="{StaticResource NextPrevButtonStyle}" Height="29" IsEnabled="{Binding GeneralSearchResult.Paging.Next, Converter={StaticResource NullToBoolConverter}, FallbackValue=False}" Background="#FFFFC700"/>
            <Button x:Name="PrevBtn" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="61" Margin="215,0,0,-6" Style="{StaticResource NextPrevButtonStyle}" Height="29" RenderTransformOrigin="0.5,0.5" IsEnabled="{Binding GeneralSearchResult.Paging.Previous, Converter={StaticResource NullToBoolConverter}, FallbackValue=False}" Background="#FFFFC700">
            	<Button.RenderTransform>
            		<CompositeTransform ScaleX="-1"/>
            	</Button.RenderTransform>
            </Button>
            <TextBox x:Name="SearchTB" HorizontalAlignment="Right" TextWrapping="Wrap" Text="Fifa" VerticalAlignment="Top" FontSize="16" Width="250" Margin="0,29,60,0" Background="{x:Null}" BorderBrush="#FFFFC700" CaretBrush="Red" Foreground="#FFDCD2D2" Style="{StaticResource SearchTBStyle}"/>
            <Button x:Name="SearchBtn" HorizontalAlignment="Right" VerticalAlignment="Top" Width="32" Margin="0,29,29,0" Height="32" Background="#FF020202" Style="{StaticResource SearchBtnStyle}" BorderBrush="#FFFFC700"/>
            </Grid>
            <Grid Visibility="{Binding IsChecked,Converter={StaticResource VisibilityConverter}, ElementName=radioButton1}">
            <ItemsControl
            	ItemTemplate="{StaticResource FriendsUpateDataTemplate}" ItemsSource="{Binding CurrentFriendPost}" Background="{x:Null}" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Margin="30,63,0,20" />
                <Button x:Name="NextBtn_Copy" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="61" Margin="0,0,185,-6" Style="{StaticResource NextPrevButtonStyle}" Height="29" IsEnabled="{Binding CanFriendGoNext}"/>
                <Button x:Name="PrevBtn_Copy" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="61" Margin="215,0,0,-6" Style="{StaticResource NextPrevButtonStyle}" Height="29" RenderTransformOrigin="0.5,0.5" IsEnabled="{Binding CanFriendGoPrev}">
            	<Button.RenderTransform>
            		<CompositeTransform ScaleX="-1"/>
            	</Button.RenderTransform>
            </Button>
            </Grid>
            <TextBlock TextWrapping="Wrap" Text="Search facebook" VerticalAlignment="Top" Foreground="#FF555555" FontSize="24" FontFamily="Franklin Gothic Heavy" Margin="228,28,0,0" HorizontalAlignment="Left" Visibility="Collapsed"/>
        </Grid>
    </Border>
</UserControl>